﻿package com.amcharts.geom
{
    import com.amcharts.utils.*;
    import flash.geom.*;

    public class Rect extends ExtendedSprite
    {
        static const VERSION:String = "1.8.3.1";

        public function Rect(param1:Number, param2:Number, param3:Array, param4:Array, param5:Number = 0, param6:Number = 0, param7:Number = 0, param8 = 0, param9:Number = 1.5708, param10:String = "linear")
        {
            var _loc_12:Number = NaN;
            var _loc_13:Number = NaN;
            var _loc_14:Number = NaN;
            var _loc_15:Number = NaN;
            var _loc_18:Array = null;
            var _loc_19:Number = NaN;
            param1 = param1 - param5;
            param2 = param2 - param5;
            x = param5 / 2;
            y = param5 / 2;
            if (param3.length > 0)
            {
                _loc_18 = new Array();
                _loc_19 = 0;
                while (_loc_19 < param3.length)
                {
                    
                    _loc_18[_loc_19] = 255 / (param3.length - 1) * _loc_19;
                    if (param4[_loc_19] == undefined)
                    {
                        param4[_loc_19] = param4[(_loc_19 - 1)];
                    }
                    param4[_loc_19] = param4[_loc_19];
                    _loc_19 = _loc_19 + 1;
                }
            }
            this.graphics.clear();
            var _loc_11:* = new Matrix();
            _loc_11.createGradientBox(param1, param2, param9, 0, 0);
            if (isNaN(param6))
            {
                param7 = 0;
            }
            if (param8 is Array)
            {
                _loc_12 = param8[0];
                _loc_13 = param8[1];
                _loc_14 = param8[2];
                _loc_15 = param8[3];
            }
            else
            {
                _loc_12 = param8;
                _loc_13 = param8;
                _loc_14 = param8;
                _loc_15 = param8;
            }
            var _loc_16:* = Math.abs(param1);
            var _loc_17:* = Math.abs(param2);
            _loc_12 = Math.min(_loc_12, _loc_16, _loc_17);
            _loc_13 = Math.min(_loc_13, _loc_16, _loc_17);
            _loc_14 = Math.min(_loc_14, _loc_16, _loc_17);
            _loc_15 = Math.min(_loc_15, _loc_16, _loc_17);
            this.graphics.beginGradientFill(param10, param3, param4, _loc_18, _loc_11);
            this.graphics.lineStyle(param5, param6, param7, true, "normal", "square");
            if (_loc_12 <= 0)
            {
            }
            if (_loc_13 <= 0)
            {
            }
            if (_loc_14 <= 0)
            {
            }
            if (_loc_15 > 0)
            {
                this.graphics.drawRoundRectComplex(0, 0, param1, param2, _loc_12, _loc_13, _loc_14, _loc_15);
            }
            else
            {
                this.graphics.drawRect(0, 0, param1, param2);
            }
            this.graphics.endFill();
            return;
        }// end function

    }
}
